#include "dockraw.h"
#include "ui_dockraw.h"

DockRaw::DockRaw(QWidget *parent) :
    QDockWidget(parent),
    ui(new Ui::DockRaw)
{
    ui->setupUi(this);
    //ui->plotter->setFftRate(10);

    ui->plotter->enablePeakDetect(false);
    ui->plotter->enableBandPlan(false);


    ui->plotter->enableMarkers(false);
    ui->plotter->setFreqUnits(1000);
    ui->plotter->setSampleRate(48000);  // Full bandwidth
    ui->plotter->setSpanFreq(12000);
    ui->plotter->setCenterFreq(0);
    ui->plotter->setPercent2DScreen(100);
   // ui->plotter->setFftCenterFreq(6000);
    //ui->plotter->setDemodCenterFreq(0);
    ui->plotter->setFilterBoxEnabled(false);
    ui->plotter->setCenterLineEnabled(false);
    ui->plotter->setBookmarksEnabled(false);
    ui->plotter->enableBandPlan(false);
    ui->plotter->setFftRange(-80., 0.);
    ui->plotter->setVdivDelta(40);
    ui->plotter->setFreqDigits(1);
    ui->plotter->setRunningState(true);
    setFftRange(0, 2400);
}

DockRaw::~DockRaw()
{
    delete ui;
}


void DockRaw::setFftRange(quint64 minf, quint64 maxf)
{
    if (true)
    {
        qint32 span = (qint32)(maxf - minf);
        quint64 fc = minf + (maxf - minf)/2;

        ui->plotter->setFftCenterFreq(fc);
        ui->plotter->setSpanFreq(span);
        ui->plotter->setCenterFreq(0);
    }
}

void DockRaw::setNewFftData(float *fftData, int size)
{
    ui->plotter->setNewFftData(fftData, size);
}
